<template>
  <view class="gi-page-list">
    <template v-if="props.loading">
      <view class="gi-page-list__loading">
        <sar-loading>加载中...</sar-loading>
      </view>
    </template>
    <template v-else-if="!props.listLength">
      <view class="gi-page-list__empty">
        <sar-empty />
      </view>
    </template>
    <template v-else>
      <slot></slot>
    </template>
  </view>
</template>

<script setup lang="ts">
interface Props {
  loading?: boolean
  listLength?: number
}

const props = withDefaults(defineProps<Props>(), {
  loading: false,
  listLength: 0,
})
</script>

<style lang="scss" scoped>
.gi-page-list__loading {
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-content: center;
}

.gi-page-list__empty {
  min-height: 600rpx;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-content: center;
}
</style>
